package com.neuron.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * ServiceRouterId entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Entity
@Table(name = "SERVICE_ROUTER")
public class ServiceRouter implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private Long tbId;
	private String comDomain;
	private String sysDomain;
	private String serviceHost;
	private String servicePort;
	private String serviceType;
	private String inParamType;
	private String outParamType;
	private int tryAgainTimes;
	private int serviceStatus;
	private String memo;
	private String pubAddress;
	private String telNum;
	private String email;
	private int weight;
	// Constructors
	@Column(name = "TEL_NUM", length = 25)
	public String getTelNum() {
		return telNum;
	}

	public void setTelNum(String telNum) {
		this.telNum = telNum;
	}
	@Column(name = "EMAIL", length = 25)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	/** default constructor */
	public ServiceRouter() {
	}

	/** full constructor */
	public ServiceRouter(Long tbId, String comDomain, String sysDomain,
			String serviceHost, String servicePort, String serviceType,
			String inParamType, String outParamType, int tryAgainTimes,
			int serviceStatus) {
		this.tbId = tbId;
		this.comDomain = comDomain;
		this.sysDomain = sysDomain;
		this.serviceHost = serviceHost;
		this.servicePort = servicePort;
		this.serviceType = serviceType;
		this.inParamType = inParamType;
		this.outParamType = outParamType;
		this.tryAgainTimes = tryAgainTimes;
		this.serviceStatus = serviceStatus;
	}

	// Property accessors
	@Id
	@Column(name = "TB_ID", precision = 14, scale = 0)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SERVICE_ROUTER_SEQ")
	@SequenceGenerator(name="SERVICE_ROUTER_SEQ" ,sequenceName="SERVICE_ROUTER_SEQ")
	public Long getTbId() {
		return this.tbId;
	}

	public void setTbId(Long tbId) {
		this.tbId = tbId;
	}

	@Column(name = "COM_DOMAIN", length = 50)
	public String getComDomain() {
		return this.comDomain;
	}

	public void setComDomain(String comDomain) {
		this.comDomain = comDomain;
	}

	@Column(name = "SYS_DOMAIN", length = 50)
	public String getSysDomain() {
		return this.sysDomain;
	}

	public void setSysDomain(String sysDomain) {
		this.sysDomain = sysDomain;
	}

	@Column(name = "SERVICE_HOST", length = 50)
	public String getServiceHost() {
		return this.serviceHost;
	}

	public void setServiceHost(String serviceHost) {
		this.serviceHost = serviceHost;
	}

	@Column(name = "SERVICE_PORT", length = 50)
	public String getServicePort() {
		return this.servicePort;
	}

	public void setServicePort(String servicePort) {
		this.servicePort = servicePort;
	}

	@Column(name = "SERVICE_TYPE", length = 50)
	public String getServiceType() {
		return this.serviceType;
	}

	public void setServiceType(String serviceType) {
		this.serviceType = serviceType;
	}

	@Column(name = "IN_PARAM_TYPE", length = 50)
	public String getInParamType() {
		return this.inParamType;
	}

	public void setInParamType(String inParamType) {
		this.inParamType = inParamType;
	}

	@Column(name = "OUT_PARAM_TYPE", length = 50)
	public String getOutParamType() {
		return this.outParamType;
	}

	public void setOutParamType(String outParamType) {
		this.outParamType = outParamType;
	}

	@Column(name = "TRY_AGAIN_TIMES", precision = 3, scale = 0)
	public int getTryAgainTimes() {
		return this.tryAgainTimes;
	}

	public void setTryAgainTimes(int tryAgainTimes) {
		this.tryAgainTimes = tryAgainTimes;
	}

	@Column(name = "SERVICE_STATUS", precision = 1, scale = 0)
	public int getServiceStatus() {
		return this.serviceStatus;
	}

	public void setServiceStatus(int serviceStatus) {
		this.serviceStatus = serviceStatus;
	}

	public void setPubAddress(String pubAddress) {
		this.pubAddress = pubAddress;
	}
	@Column(name = "PUB_ADDRESS", length = 500)
	public String getPubAddress() {
		return pubAddress;
	}
	public void setWeight(int weights) {
		this.weight = weights;
	}
	@Column(name = "WEIGHT", length = 2)
	public int getWeight() {
		return weight;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	@Column(name = "MEMO", length = 500)
	public String getMemo() {
		return memo;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((comDomain == null) ? 0 : comDomain.hashCode());
		result = prime * result + ((inParamType == null) ? 0 : inParamType.hashCode());
		result = prime * result + ((memo == null) ? 0 : memo.hashCode());
		result = prime * result + ((outParamType == null) ? 0 : outParamType.hashCode());
		result = prime * result + ((pubAddress == null) ? 0 : pubAddress.hashCode());
		result = prime * result + ((serviceHost == null) ? 0 : serviceHost.hashCode());
		result = prime * result + ((servicePort == null) ? 0 : servicePort.hashCode());
		result = prime * result + serviceStatus;
		result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
		result = prime * result + ((sysDomain == null) ? 0 : sysDomain.hashCode());
		result = prime * result + ((tbId == null) ? 0 : tbId.hashCode());
		result = prime * result + tryAgainTimes;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ServiceRouter other = (ServiceRouter) obj;
		if (comDomain == null) {
			if (other.comDomain != null)
				return false;
		} else if (!comDomain.equals(other.comDomain))
			return false;
		if (inParamType == null) {
			if (other.inParamType != null)
				return false;
		} else if (!inParamType.equals(other.inParamType))
			return false;
		if (memo == null) {
			if (other.memo != null)
				return false;
		} else if (!memo.equals(other.memo))
			return false;
		if (outParamType == null) {
			if (other.outParamType != null)
				return false;
		} else if (!outParamType.equals(other.outParamType))
			return false;
		if (pubAddress == null) {
			if (other.pubAddress != null)
				return false;
		} else if (!pubAddress.equals(other.pubAddress))
			return false;
		if (serviceHost == null) {
			if (other.serviceHost != null)
				return false;
		} else if (!serviceHost.equals(other.serviceHost))
			return false;
		if (servicePort == null) {
			if (other.servicePort != null)
				return false;
		} else if (!servicePort.equals(other.servicePort))
			return false;
		if (serviceStatus != other.serviceStatus)
			return false;
		if (serviceType == null) {
			if (other.serviceType != null)
				return false;
		} else if (!serviceType.equals(other.serviceType))
			return false;
		if (sysDomain == null) {
			if (other.sysDomain != null)
				return false;
		} else if (!sysDomain.equals(other.sysDomain))
			return false;
		if (tbId == null) {
			if (other.tbId != null)
				return false;
		} else if (!tbId.equals(other.tbId))
			return false;
		if (tryAgainTimes != other.tryAgainTimes)
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "ServiceRouter [comDomain=" + comDomain + ", inParamType=" + inParamType + ", outParamType=" + outParamType
				+ ", serviceHost=" + serviceHost + ", servicePort=" + servicePort + ", serviceStatus=" + serviceStatus + ", serviceType="
				+ serviceType + ", sysDomain=" + sysDomain + ", tbId=" + tbId + ", tryAgainTimes=" + tryAgainTimes + "]";
	}
}